package expriment4_T6;

public class Manager {
    String name;
    int age;
    String sex;
    double sal;

    public Manager() {
    }

    public Manager(String name, int age, String sex, double sal) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.sal = sal;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getSex() {
        return sex;
    }

    public double getSal() {
        return sal;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    @Override
    public String toString() {
        return "Manager[" +
                "name=" + name +
                ", age=" + age +
                ", sex=" + sex +
                ", sal=" + sal +
                ']';
    }
    public void judge() {
        System.out.printf(getName());
        if (age < 40)
            System.out.println("需要加班");
        else
            System.out.println("不需要加班");
    }
}
class ManagerDemo{
    public static void main(String[] args) {
        System.out.println("无参函数如下：");
        Manager m1 = new Manager();
        m1.setName("佟丽娅");
        m1.setAge(27);
        m1.setSex("女");
        m1.setSal(8888.88);
        System.out.println(m1);
        m1.judge();
        System.out.println("-----------------------");
        System.out.println("有参函数如下：");
        Manager m2 = new Manager("蔡徐坤",35,"男",29999.99);
        System.out.println(m2);
        m2.judge();
    }
}
